;;; -*- Syntax: Common-Lisp; Package: AUTOCLASS; Base: 10; Mode: LISP -*-

;;; NOTE: This script is for the Symbolics Genera environment.

;;; The files in this directory were created by the following process:


;;; (1) GET SOME DATA

;we got many data sets from the machine learning repository at UCI

tcp ....
get ... 

; resulting data in files:  imports-85.data  and  imports-85.names

;;; (2) CONVERT TO AUTOCLASS FORMAT

Rename File imports-85.data to imports-85.db2

; using imports-85.names as a source, create files:
; imports-85.hd2  and  imports-85.model
; based on >doc>input.text documentation file

;;; (3) LOAD AUTOCLASS SYSTEM

(load "cha:>p>autoclass>load-ac.lisp")

(in-package 'ac)

;;; (4) CHECK CORRECTNESS OF INPUT FILES

(autoclass-input-check
  :data-file "cha:>p>autoclass>sample>imports-85"
  :header-file "imports-85" :model-file "imports-85")

;at this point a log file was begun:
;  "cha:>p>autoclass>sample>imports-85&imports-85&imports-85.log"

;could have left this optional step out and the search would have worked

;;; (5) SEARCH FOR GOOD CLASSIFICATIONS

(multiple-value-setq (search classifications)
  (autoclass-search :data-file "cha:>p>autoclass>sample>imports-85"
                    :header-file "imports-85" :model-file "imports-85"))

;could have done this instead:
; (autoclass-search :data-file "cha:>p>autoclass>sample>imports-85")

;type a "q" to stop

;these files will be saved to disk:
; "cha:>p>autoclass>sample>imports-85&imports-85&imports-85.search"
; "cha:>p>autoclass>sample>imports-85&imports-85&imports-85.dump"
;and the .log file will be updated

;;; (6) RESTART SEARCH  

;continue the previous search

(autoclass-search :search search)

;could have done:
;(autoclass-search :search *)

;type a "q" to stop


;;; (7) START A NEW SEARCH

;this search starts over, doesn't save to disk, and uses a variation

(autoclass-search :clsf (elt classifications 0) :force-new-search-p t
  :results-file-p nil :search-file-p nil :log-file-p nil
  :try-fn (second *try-fn-list*) :max-duration 300)

;it stops itself this time after 5 minutes


;;; (8) RESTART THE FIRST SEARCH IN NEW ENVIRONMENT

Logout, Halt Machine, Boot, Login

(load "cha:>p>autoclass>load-ac.lisp")
(in-package 'ac)

(autoclass-search
  :output-files-default "cha:>p>autoclass>sample>imports-85&imports-85&imports-85")

;type a "q" to stop


;;; (9) PRINT OUT REPORTS ON WHAT HAS BEEN FOUND

(ac-3:autoclass-reports-from-results-file
  	  "cha:>p>autoclass>sample>imports-85&imports-85&imports-85"     
  	  :xref-class-report-att-list '(2 5 6))

;these reports show up in:
; "imports-85&imports-85&imports-85.influ-text"
; "imports-85&imports-85&imports-85.case-text"
; "imports-85&imports-85&imports-85.class-text"

